package com.qf.controller;

import java.util.Arrays;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.common.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import com.qf.entity.AddressEntity;
import com.qf.service.AddressService;


/**
 * @author Java2102
 * @email Java2102@qf.com
 * @date 2021-07-19 14:29:44
 */
@RestController
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressService addressService;

    @RequestMapping("/getAddressListByUid/{uid}")
    public List<AddressEntity> getAddressListByUid(@PathVariable("uid") Integer uid) {
        QueryWrapper<AddressEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("uid", uid);
        return addressService.list(wrapper);
    }


    @RequestMapping("/save")
    public Boolean save(@RequestBody AddressEntity address) {
        return addressService.save(address);
    }

    @GetMapping("/getAddressByUid/{id}")
    public AddressEntity getAddressByUid(@PathVariable("id") Integer id) {
        return addressService.getById(id);
    }

}
